#include "Http.hpp"
#include "TcpServer.hpp"
#include <memory>

// ./server 8080
int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        std::cout << "Usage: \r\n" << "\t" << argv[0] << " [port]" << std::endl;
    }

    uint16_t port = std::stoi(argv[1]);
    const std::string ip = "0.0.0.0";

    HttpServer hs;

    func_t callback = std::bind(&HttpServer::HttpHelper, &hs, std::placeholders::_1, std::placeholders::_2);
    std::shared_ptr<TcpServer> ts = std::make_shared<TcpServer>(ip, port, callback);
    ts->Start();
    std::cout << "server begin..." << std::endl;
    std::cout << "Run begin..." << std::endl;
    ts->Run();

    return 0;
}